<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>欢迎登录后台管理系统</title>
<link href="__STATIC__/Admin/css/base.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/Admin/css/right.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/css/page.css" rel="stylesheet" type="text/css">
<script src="__STATIC__/js/jquery-2.1.1.min.js"></script>
<script>
$(document).ready(function(){
   $(function(){
      $('.rightinfo tbody tr:odd').css("backgroundColor","#f5f8fa");
   });
});
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li><a href="{:url('Index/center')}">首页</a></li>
    <li><a>场次管理</a></li>
  </ul>
</div>
<div class="rightinfo">
  
    <table class="tablelist">
    <thead>
      <tr>
        <th>场次名称</th>
        <th>赔率（如190则为1.9赔率）</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
    {volist name="list" id="vo"}
      <tr height="45" align="center">
        <td><h4 color="#FF0000">{$vo['name']}</h4></td>
        <td>{$vo['peilv']}</td>
        <td>
        <img src="__STATIC__/Admin/image/leftico03.png" width="14">
          <a class="editType" href="#" val="{$vo['id']}">修改赔率</a>&nbsp;
        </td>
      </tr>
    {/volist}
    </tbody>
  </table>
  
</div>
<script>
    //赔率正则
    function validateInt(val){
        var reg = /^\+?[0-9][0-9]*$/;
         return reg.test(val)
         }

    //修改赔率
    $(function(){
        $(".editType").click(function(){
            var id = $(this).attr('val');
            var peilv = prompt("请输入赔率(大于0的整数)",0);
            if(!validateInt(peilv)||peilv<=0){
                alert("请输入大于0的整数");
                return false;
            }
            $.post("{:url('Types/modprecent')}",{id:id,peilv:peilv},function (data) {
                if(data.flag == 0) {
                    alert('修改成功');
                    window.location.reload();
                }
            },'json');
        });
    });
</script>
</body>
</html>